package com.example.demo.sensitive.dto.response;

import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @ClassName CheckTaskResponse
 * @Description 检查任务响应对象
 * @Author System
 * @Date 2025/9/19
 **/
@Data
public class CheckTaskResponse {

    /**
     * 任务ID - 使用String避免JavaScript精度丢失
     */
    private String taskId;

    /**
     * 任务名称
     */
    private String taskName;

    /**
     * 任务状态
     */
    private String status;

    /**
     * 任务状态描述
     */
    private String statusDesc;

    /**
     * 数据库配置ID
     */
    private Long databaseConfigId;

    /**
     * 目标数据库名称
     */
    private String databaseName;

    /**
     * 选定的表名列表
     */
    private List<String> selectedTables;

    /**
     * 选定的敏感词列表
     */
    private List<String> selectedKeywords;

    /**
     * 批处理大小
     */
    private Integer batchSize;

    /**
     * 任务进度百分比
     */
    private Integer progressPercentage;

    /**
     * 总表数
     */
    private Integer totalTables;

    /**
     * 已检查表数
     */
    private Integer checkedTables;

    /**
     * 发现问题数
     */
    private Integer foundIssues;

    /**
     * 耗时 (毫秒)
     */
    private Long elapsedTime;

    /**
     * 任务统计
     */
    private TaskStatistics statistics;

    /**
     * 任务开始时间
     */
    private LocalDateTime startTime;

    /**
     * 任务结束时间
     */
    private LocalDateTime endTime;

    /**
     * 错误信息
     */
    private String errorMessage;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    @Data
    public static class KeywordInfo {
        private Long id;
        private String word;
        private String category;
        private Integer level;
    }

    @Data
    public static class TaskProgress {
        private String status;
        private Integer progress;
        private Integer percentage;  // 前端期望的字段名
        private String message;      // 前端期望的状态消息
        private Integer checkedTables;
        private Integer totalTables;
        private Long checkedRecords;
        private Long totalRecords;
        private Integer foundIssues;
        private Long elapsedTime;
    }

    @Data
    public static class TaskStatistics {
        private Integer totalTables;
        private Long totalRecords;
        private Integer foundIssues;
        private Integer highRiskIssues;
        private Integer processedIssues;
        private Long executionTime;
    }
}
